<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j"
                template="layout/site-template.xhtml">

     <ui:define name="scripts">
        <link rel="stylesheet"
              href="js/jqzoom_ev1.0.1/css/jqzoom.css"/>
        <a4j:loadScript src="resource://jquery.js"/>
        <script type='text/javascript'
                src='js/jqzoom_ev1.0.1/js/jquery.jqzoom1.0.1.js'></script>
        <script type="text/javascript">
            jQuery(document).ready(function() {
                var options = {
                    zoomWidth: 350,
                    zoomHeight: 225,
                    xOffset: 10,
                    yOffset: 0,
                    position: "right" //and MORE OPTIONS
                };
                jQuery('.zoomable').jqzoom(options);
            });
        </script>
    </ui:define>

    <ui:define name="menu">
        <ui:include src="view/includes/menu/richmenuform.xhtml"/>
    </ui:define>

    <ui:define name="page-title">
        <h2>#{pageHome.instance.title}</h2>
    </ui:define>

    <ui:define name="left-content">

        <ui:repeat var="_page"
                   value="#{childPages}">
            <rich:panel bodyClass="hide">
                <f:facet name="header">
                    <s:link value="#{_page.title}"
                            view="/page.xhtml"
                            title="#{_page.title}"
                            propagation="none">
                        <f:param name="pageId"
                                 value="#{pageHome.instance.id}"/>
                        <f:param name="childId"
                                 value="#{_page.id}"/>
                    </s:link>
                </f:facet>
            </rich:panel>
        </ui:repeat>
    </ui:define>

    <ui:define name="main-content-body">
        <f:subview id="childIdNotPresentSubview"
                   rendered="#{empty childId}">
            <h1><h:outputText value="#{pageHome.instance.title}"/></h1>
            <rich:dataList value="#{pageHome.instance.files}"
                           var="_file"
                           styleClass="imagelist">
                <a href="#{settingsList.singleResult.filePathClient}#{_file.fileName}"
                   class="zoomable"
                   title="#{_file.page.title}">
                    <s:graphicImage value="#{_file.originalByte.image}"
                                    fileName="#{_file.id}_large"
                                    alt="[image]"
                                    styleClass="small">
                        <s:transformImageSize width="300"
                                              maintainRatio="true"/>
                    </s:graphicImage>

                </a>
            </rich:dataList>
            <h:outputText value="#{pageHome.instance.content}"
                          escape="false"/>
            <s:link value="edit page"
                    view="/admin.xhtml"
                    styleClass="editlink"
                    rendered="#{identity.hasRole('admin')}">
                <f:param name="pageId"
                         value="#{pageHome.instance.id}"/>
                <f:param name="view"
                         value="page"/>
            </s:link>
        </f:subview>
        <f:subview id="childIdPresentSubview"
                   rendered="#{not empty childId}">
            <h1><h:outputText value="#{child.title}"/></h1>
            <rich:dataList value="#{child.files}"
                           var="_file"
                           styleClass="imagelist">
                <s:graphicImage value="#{_file.croppedByte.image}"
                                fileName="#{_file.id}_large"
                                alt="[image]"/>
            </rich:dataList>
            <h:outputText value="#{child.content}"
                          escape="false"/>

            <s:link value="edit page"
                    view="/admin.xhtml"
                    rendered="#{identity.hasRole('admin')}"
                    propagation="none"
                    styleClass="editlink">
                <f:param name="pageId"
                         value="#{child.id}"/>
                <f:param name="view"
                         value="page"/>
            </s:link>
        </f:subview>


    </ui:define>

    <ui:define name="footer">
        <h4>adm 'at' glxn.net </h4>
    </ui:define>
</ui:composition>
